<template>
  <slot />
</template>

<script setup lang="ts">
import { watch } from 'vue'
import { useChangeI18nHook } from '../language'
import type { PropType } from 'vue'
import type { TGlobalSettingParams } from '../types/components'

const props = defineProps({
  lang: {
    type: String as PropType<TGlobalSettingParams>,
    default: 'zh'
  }
})

const { changeLang } = useChangeI18nHook()

const initLang = () => {
  changeLang(props.lang)
}

watch(() => props.lang, () => {
  initLang()
}, { immediate: true })
</script>

<style scoped lang="scss">

</style>
